home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / edit / gg_m103.zip / M.TUT < prev    next >
Text File  |  1994-04-06  |  47KB  |  918 lines

  1.         The M Tutorial File
  2.  
  3. You may ask why this editor is called M...  It is called M because it is My
  4. editor... the editor I wrote, Mine.  It can be your editor too.
  5.  
  6. In this file I will walk you through the features of M.  To walk around in
  7. this text, use the arrow keys, [pageUp], and [pageDown].  They behave like
  8. you would expect them to...  As a preliminary, I'll explain notation. 
  9. Characters in square brackets are M commands...  (This is to set them off
  10. from the rest of the text.)  The Alternate and Control keys are used like
  11. the shift key. In this tutorial I'll abreviate Control by a caret "^" and
  12. Alternate by "Alt".  
  13.     For example: 
  14. [^X] is Control_X
  15. [Alt G 2] is Alt_G and then 2.
  16. [^X ^F] is Control_X Control_F
  17. [Alt ^M] is Alt_Control_M
  18.  
  19. In the event you want to EXIT right away... there are two principal ways to
  20. exit M...  The first is the exit without saving [^X ^C], if there are no
  21. modified files you will be out.  If there are modified files you will be
  22. told of that fact and asked if you want to save them.  If yes, you will be
  23. asked about each file on your way out.  ([Escape] and [^G] will abort the
  24. exit.)  The second exit method is the save all files and exit [Alt Z]. 
  25. (The mnemonic is that Z is the last letter in the alphabet, [Alt Z] is the
  26. last thing you type before leaving.)
  27.  
  28.     I begin with an introductory note on the general theory of M.  In M
  29. there are windows and buffers (buffers = files).  A window is a view into a
  30. buffer and is only loosely connected to a buffer.  You can switch the
  31. buffer a window is connected to very easily.  You can have many more
  32. buffers open than you have windows to view them.  You can also have many
  33. windows open on the same buffer.  All combinations are possible.  Every
  34. window has a StatusLine with sundry information about the current buffer. 
  35. Every window has a current cursor position (although only the active window
  36. has a visible cursor).  Every window has a mark.  The mark is an old cursor
  37. position used in block delete and block copys.  (Occasionally I may refer
  38. to the cursor as the point, I use the terms point and cursor
  39. interchangeably.)  The actual location of the cursor is between letters... 
  40. The cursor visible on the screen is underneath a letter, the real cursor
  41. location is just in front of that character.
  42.     The [Escape] is not treated like other keys in M, typing an
  43. [Escape] prior to another key is equivalent to holding down Alt while
  44. typing that key.  You can think of the letters you type as a stream of
  45. characters coming to the program.  When you type an [Alt Z] for example I
  46. stick into the character stream first an [Escape] and then a [Z]...  You
  47. can just as easily type an [Escape] and then a [Z] yourself...  (In some
  48. contexts I peek if there is a character behind the [Escape]...  If there
  49. isn't one I know that you have typed a lone [Escape] and not a Alt key
  50. combination.  In some situations I interpret a lone [Escape] as an
  51. abort...)
  52.  
  53. When a new command is described in this text, try it!  If that command is
  54. destructive add some garbage text to play with...
  55.  
  56.  
  57. For those who are familiar with emacs, M's command structure is very
  58. similar to that.  Most common emacs commands are supported with the key
  59. strokes you are used to.
  60.  
  61.  
  62. Cursor Motion:
  63.     The arrow keys, [pageUp] and [pageDown] keys move like you expect
  64. them... The analogous emacs move cursor commands [^F] forward, [^B]
  65. backward, [^P] up, [^N] down, [Alt V] pageUp and [^V] pageDown keys are
  66. supported.  The [Home] and [End] keys work slightly differently than
  67. expected...  When you first type [Home] the cursor moves to the front of
  68. the line, the second time it moves to the top of the page, the third time
  69. to the top of the file.  The [End] key works similarly.  
  70.  
  71. The emacs commands [^A] front of line, [^E] end of line [Alt <] top of
  72. file, [Alt >] end of file also work. 
  73.  
  74. [^RightArrow] moves right by one word (same as [Alt F]). 
  75. [^LeftArrow] moves left by one word (same as [Alt B]).
  76. [^UpArrow] moves up by paragraphs (in Cmode a paragraph is a curly brace).
  77. [^DownArrow] moves down by paragraphs (in Cmode a paragraph is a curly brace).
  78.  
  79. Notice as you move the cursor the 2 numbers on the StatusLine following the
  80. buffer name change... they are the line number and the column number. You
  81. can move to a particular line using the goto command [Alt G (number)
  82. Enter].  (You can abort this dialog with an [Escape] or a [^G]; [^G] is
  83. the all purpose abort.)
  84.  
  85. The last of the simple cursor movement commands is the exchange cursor and
  86. mark command [^X .].  Prior to executing this it is useful to set a mark to
  87. a particular location.   Both [Alt Spacebar] and [^Spacebar] set the mark
  88. to the current cursor position.  Try setting a mark and switching the mark
  89. and the cursor.
  90.  
  91. As a final suggestion, I like it better when the cursor moves quickly...  I
  92. use the dos mode command in my autoexec.bat to do this for me.  In my
  93. autoexec I have:
  94.     mode con rate=32, delay=1
  95.  
  96. Deleting and Copying:
  97.     M has a killBuffer that it stores things in.  It uses the
  98. killBuffer as a clipboard for block copys and pastes.  There are a number
  99. of ways to put text into the killBuffer.  The first way is to copy a block
  100. into it.  Set a mark [Alt Spacebar] (or [^Spacebar]), move the cursor to a
  101. new position, and do an alt wipe [Alt W].  The text between the mark and
  102. the cursor has been copied into the killBuffer.  Next move the cursor to an
  103. empty line and do a Yank [^Y].  Do another Yank, and another...  You now
  104. have multiple copies of the text. 
  105.     Another way to get text into the killBuffer is to do a control
  106. wipe.  Like the last time, set a mark [Alt Spacebar] or [^Spacebar], move
  107. the cursor, and Wipe [^W].  This Wipe deletes the text while moving it into
  108. the killBuffer.  The deleted text can now be yanked anywhere you want it. 
  109.     There are more methods of putting text into the killBuffer.  You
  110. can kill individual lines with [Alt K] and [^K].  [^K] kills from the
  111. cursor to the end of the line.  [Alt K] kills the whole line irrespective
  112. of where the cursor is in the line.  If one kill command directly follows
  113. another, instead of throwing out the old killBuffer and replacing it with
  114. the new kill, the killBuffer appends the new kill to the existing
  115. killBuffer.  Try killing a whole bunch of lines in a row and yanking them
  116. all back in one yank.
  117.     There are a few more ways to wipe text into the killBuffer, you can
  118. kill by words.  The [^Backspace] and the [^Delete] are word delete left and
  119. word delete right.  Again multiple consecutive kills append into the
  120. killBuffer.  
  121.     Finally there are some word copys into the killBuffer, [Alt
  122. Backspace] and [Alt Delete].  Multiple consecutive copys append into the
  123. killBuffer.  Notice the control commands [^W] [^Backspace] and [^Delete]
  124. are kills while the alt commands [Alt W] [Alt Backspace] and [Alt Delete]
  125. are copys.
  126.     There is also Column deletes and yanks...  To do a column wipe, set
  127. a column mark [ALT ^spacebar].  Move the cursor to the other corner of the
  128. rectangular block you are interested in.  Either [Alt W] (copy) or [^W]
  129. (delete) the column into the kill buffer.
  130.     The column Yank [ALT ^Y] yanks the contents of the kill buffer in a
  131. column way at the cursor.  You can do a column yank of the kill buffer
  132. irrespective of how the the kill buffer was loaded (you did not have to
  133. fill it with a column wipe).  You could have done normal [Alt K] kills to
  134. load it.  When you column yank, the kill buffer is searched for the longest
  135. line and all the other lines in it are padded with spaces to that length.
  136. A rectangular piece of text is inserted at the cursor.
  137.     There is one more yank feature, the yankPop [Alt Y].  It is easiest
  138. to describe what it does by actually doing it.  Move to the line of 1's and
  139. do an [Alt K] immediately followed by a [^Y], do the same thing on the line
  140. of 2's, next on the 3's, and finally on the 4's.  Now we are in a position
  141. to show off the yankPop.  Move the cursor to a blank line and yankPop [Alt
  142. Y].  And [Alt Y] again and again and again...  There is really a ring of 4
  143. different killBuffers.  When you ki